<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>版式文件盖章演示程序1.0</title>
    <link href="css/sxca_ceb.css" rel="stylesheet">
    <script type="text/javascript" src="js/jithttpclient.js"></script><!--第三方应用必须引入的JS文件-->
    <script type="text/javascript" src="js/sxcaCebPageSeal.js"></script><!--第三方应用必须引入的JS文件-->

</head>
<body>
<script type="text/javascript">
    window.onload = function () {
        //设置电子印章服务器地址
        sxca_ceb.constant.setSeverUrl("http://183.201.231.28:60887");
        //初始化
        var initRes = sxca_ceb.ready.init();
        //加载文件
        sxca_ceb.business.loadFile("56fc15bcf1c84927979bc273261be099");//横向

        if (initRes && initRes.code == "0") {
            //验证多用户证书,加载电子印章
            sxca_ceb.business.loadMultUserCerts();
            // -----------------------------------版式文件设置参数操作开始------------------------------------
            //设置印章类型
            // sxca_ceb.business.setSealType("1");
            //设置不允许拖拽印章
            // sxca_ceb.switch.setSealDrag(0);
            // sxca_ceb.business.setSealParamInfo(1, 500, 400);
            //设置允许打印文档
            sxca_ceb.switch.setAllowPrintmeFile(1);
            //-----------------------------------版式文件设置参数操作结束------------------------------------
        } else {
            console.log(initRes.msg);
        }
    }

</script>
<div class="sxca-body">
    <header class="sxca-page-header">
        <a class="sxca-header-left"> 返回 </a>
        <div class="sxca-header-title">
            拖动签署位置
        </div>
        <div class="sxca-header-right">
            <a class="printme-a-button" rel="external nofollow" id="printme_file" target="_self">打印</a>
        </div>
    </header>
    <div class="sxca-panel">
        <div class="sxca-panel-left">
            <div class="sxca-signet-form">
                <div class="explain-panel">

                    <span>指定位置盖章</span>
                    <p>您可以点击确定选择印章，落章之后点击保存，完成文件签署。</p>
                </div>
                <div class="sxca-signet-form-panel">
                    <div class="sxca-signet-form-panel-tit">当前证书</div>
                    <div class="sxca-signet-form-panel-con" style="height: 55px">
                        <div style="padding: 8px 5px 0 5px;font-size: 16px;color: orangered;font-weight: bold;height: 50px"
                             id="current-cert-dn">

                        </div>
                    </div>
                </div>
                <div class="sxca-signet-form-panel">
                    <a href="javascript:void(0)" id="select_cert">
                        <div class="refresh_btn" id="sxca_seals_refresh"></div>
                    </a>
                    <div class="sxca-signet-form-panel-tit">印章选择</div>
                    <div class="sxca-signet-form-panel-con">
                        <div class="signet-switch clearfix">
                            <div class="sxca-f-left" id="sxca_ceb_pre"></div>
                            <div class="sxca-f-left signet-switch-panel">
                                <div class="signet-switch-imgBox" id="sxca_ceb_seals_load">
                                </div>
                            </div>
                            <div class="sxca-f-right" id="sxca_ceb_next"></div>
                        </div>
                        <div class="signet-switch-title"><span id="signet_tit"></span><span id="signet_id"></span></div>
                    </div>
                </div>
                <div class="sxca-margin-top"><input class="sxca-submit-btn btnColor-01" type="button" id="sxca_ceb_sure"
                                                    value="确定" style="display: none"></div>
                <div class="sxca-margin-top"><input class="sxca-submit-btn btnColor-01" type="button" id="sxca_ceb_sub"
                                                    value="保存"></div>
                <div class="sxca-margin-top"><input class="sxca-submit-btn btnColor-01" type="button" id="getVersion"
                                                    value="获取控件版本"></div>
                <div class="sxca-margin-top"><input class="sxca-submit-btn btnColor-01" type="button"
                                                    id="getCurrentSubject" value="获取当前证书"></div>
                <div class="sxca-margin-top"><input class="sxca-submit-btn btnColor-01" type="button"
                                                    id="getCurrentSeal" value="获取当前印章"></div>
            </div>
        </div>
        <div class="sxca-panel-center" style="border:0px solid red;" id="sxca_ceb_middle">
            <div class="sxca-content-show" id="sxca_ceb_dom">
            </div>
        </div>
        <div class="sxca-panel-right">
            <div class="sxca-signature-right-box">
                <div class="sxca-start-box">
                    <div class="sxca-start-btn" id="sxca_ceb_startBtn2"><a class="start-btn">首页</a></div>
                </div>
                <div class="sxca-list-box">
                    <ul class="sxca-signature-right-list">
                    </ul>
                </div>

                <div class="sxca-last-box">
                    <div class="sxca-last-btn" id="sxca_ceb_lastBtn2"><a class="last-btn">尾页</a></div>
                    <div class="clearfix">
                        <div class="sxca-f-left col7">
                            <input type="text" class="sxca-input-text" placeholder="请输入页码跳转" maxlength="6"
                                   id="sxca_seach_text2">
                        </div>
                        <div class="sxca-f-left sxca-text-r col3">
                            <button type="button" class="seach-btn" id="sxca_seach_btn2"></button>
                        </div>
                    </div>
                </div>

            </div>

        </div>
        <div class="sxca-panel-footer">
            <span>Copyright © 山西省数字证书认证中心（有限公司）</span>
        </div>
    </div>
</div>
<div class="sxca-tooltip-box2" style="display:none;">
</div>
<div class="sxca-ceb-popupBg" style="display:none;" id="sxca-ceb-tipPop">
</div>
</body>
<script>
    var selectCert = document.getElementById("select_cert");
    selectCert.onclick = function () {
        jit_ceb.business.getCertInfoList();
        //验证多用户，加载电子印章
        sxca_ceb.business.loadMultUserCerts();
    }
    var subButton = document.getElementById("sxca_ceb_sub");
    subButton.onclick = function () {
        subButton.disabled = true;
        sxca_ceb.business.saveSignHandle(function (obj) {
            console.log(obj)
            subButton.disabled = false;
            window.parent.postMessage({ type: 'sealSaved' }, '*');
        });
    }
    var getVersion = document.getElementById("getVersion");
    getVersion.onclick = function () {
        var res = sxca_ceb.business.getVctkVersion();
        alert(JSON.stringify(res))
    }
    var getCurrentSubject = document.getElementById("getCurrentSubject");
    getCurrentSubject.onclick = function () {
        var res = sxca_ceb.business.getCurrentCertDN();
        alert(JSON.stringify(res))
    }
    var getCurrentSeal = document.getElementById("getCurrentSeal");
    getCurrentSeal.onclick = function () {
        var res = sxca_ceb.business.getCurrentSealName();
        alert(JSON.stringify(res))
    }

</script>
</html>
